﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace 考勤统计
{
    public partial class Form2 : Form
    {
        public Form2()
        {
            InitializeComponent();
        }
        public static List<int> jjrday = new List<int> { };
        public static List<int> txday = new List<int> { };

        public void cbxstate(CheckBox checkBox)
        {
            if (checkBox.CheckState == CheckState.Checked)
            {
                jjrday.Add(int.Parse(checkBox.Text));
            }
            if (checkBox.CheckState == CheckState.Indeterminate)
            {
                txday.Add(int.Parse(checkBox.Text));
            }
        }

        private void button1_Click(object sender, EventArgs e)
        {
            jjrday.Clear();
            txday.Clear();
            cbxstate(cbx_1);
            cbxstate(cbx_2);
            cbxstate(cbx_3);
            cbxstate(cbx_4);
            cbxstate(cbx_5);
            cbxstate(cbx_6);
            cbxstate(cbx_7);
            cbxstate(cbx_8);
            cbxstate(cbx_9);
            cbxstate(cbx_10);
            cbxstate(cbx_11);
            cbxstate(cbx_12);
            cbxstate(cbx_13);
            cbxstate(cbx_14);
            cbxstate(cbx_15);
            cbxstate(cbx_16);
            cbxstate(cbx_17);
            cbxstate(cbx_18);
            cbxstate(cbx_19);
            cbxstate(cbx_20);
            cbxstate(cbx_21);
            cbxstate(cbx_22);
            cbxstate(cbx_23);
            cbxstate(cbx_24);
            cbxstate(cbx_25);
            cbxstate(cbx_26);
            cbxstate(cbx_27);
            cbxstate(cbx_28);
            cbxstate(cbx_29);
            cbxstate(cbx_30);
            cbxstate(cbx_31);
            string jjr = "";
            foreach (var item in jjrday)
            {
                jjr += item + ";";
            }
            string tx = "";
            foreach (var item in txday)
            {
                tx += item + ";";
            }
            string msg="";
            if (jjrday.Count>0)
            {
                msg += "节假日：" + jjr+"\r\n";
            }
            if (txday.Count > 0)
            {
                msg += "春节调休：" + tx + "\r\n";
            }
           var result =  MessageBox.Show(msg.Trim(),"确认", MessageBoxButtons.OKCancel,MessageBoxIcon.Warning);
            if (result == DialogResult.Cancel)
            {
                jjrday.Clear();
                txday.Clear();
                return;
            }
            this.Close();
        }

        private void button2_Click(object sender, EventArgs e)
        {
            this.Close();
        }
    }
}
